<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	function lichenArray(arr){
		return arr.reduce((tempArr,item) => {
			return  tempArr.concat(Array.isArray(item) ? lichenArray(item) : item)
		},[])
	}
	let arr = [0,[1,2],[3,[4,5]]]
	console.log(lichenArray(arr))
	console.log(arr.flat(Infinity))
</script>
</html>